package moplayer;

import java.util.Date;

import com.illposed.osc.OSCMessage;

public class RhythmTrack implements TrackRT {

	private String[][] cells = { { "q", "q", "q", "q" }, { "q*", "q*", "q*" } };
	private String[] currentRhythmCell = null;
	private int countRhythm;
	private int indexCell;

	@Override
	public NoteRT getNoteToPlay() {
		NoteRT note = new NoteRT();
		long duration;
		if ((currentRhythmCell == null) || countRhythm == currentRhythmCell.length) {
			currentRhythmCell = cells[indexCell];
			countRhythm = 0;
		}
		if (countRhythm == 0) {
			note.setDynamics(70);
			note.setPitch(60);
		} else {
			note.setDynamics(70);
			note.setPitch(64);
		}
		duration = UtilRT.getRhythmValueByDuration(currentRhythmCell[countRhythm]);
		note.setDuration(duration);
		countRhythm = countRhythm + 1;
		return note;
	}

	public void setIndexCell(int indexCell) {
		this.indexCell = indexCell;
	}

	@Override
	public NoteRT getArpeggioNote(boolean crescente) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void acceptMessage(Date arg0, OSCMessage arg1) {
		// TODO Auto-generated method stub

	}

	@Override
	public NoteRT getCromaticNote(boolean crescente) {
		// TODO Auto-generated method stub
		return null;
	}

}
